-
Notifications
You must be signed in to change notification settings - Fork 334
ValidationScheme implements pflag.Value and json.Marshaler/Unmarshaler interfaces #807
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ValidationScheme implements pflag.Value and json.Marshaler/Unmarshaler interfaces #807
Conversation
70453fd
to
06cb330
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand why you're removing the fmt.Stringer
assertion.
06cb330
to
8454829
Compare
…er/Unmarshaler interfaces Signed-off-by: Julius Hinze <[email protected]>
8454829
to
2e9eb8f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements the pflag.Value
and json.Marshaler/Unmarshaler
interfaces for the ValidationScheme
type, enabling it to be used as a command-line flag and for JSON serialization/deserialization.
- Adds JSON marshaling/unmarshaling methods for
ValidationScheme
- Implements
pflag.Value
interface withSet()
andType()
methods - Refactors existing YAML unmarshaling to use the new
Set()
method
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
model/metric.go | Implements JSON and pflag interfaces, refactors YAML unmarshaling |
model/metric_test.go | Adds comprehensive test coverage for JSON marshaling and pflag Set method |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, except for a couple of superfluous casts.
Signed-off-by: Arve Knudsen <[email protected]>
Signed-off-by: Arve Knudsen <[email protected]>
…etheus/common/model.ValidationScheme (#12505) <!-- Thanks for sending a pull request! Before submitting: 1. Read our CONTRIBUTING.md guide 2. Rebase your PR if it gets out of sync with main --> #### What this PR does Removes unnecessary `validation.ValidationSchemeValue` because prometheus/common#807 was merged. #### Checklist - [x] Tests updated. - [ ] Documentation added. - [ ] `CHANGELOG.md` updated - the order of entries should be `[CHANGE]`, `[FEATURE]`, `[ENHANCEMENT]`, `[BUGFIX]`. If changelog entry is not needed, please add the `changelog-not-needed` label to the PR. - [ ] [`about-versioning.md`](https://github.com/grafana/mimir/blob/main/docs/sources/mimir/configure/about-versioning.md) updated with experimental features.
No description provided.